<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.5,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no, email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <!-- 删除苹果默认的工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <!-- 设置苹果工具栏颜色 -->
    <meta name="format-detection" content="telphone=no, email=no" />
    <!-- 忽略页面中的数字识别为电话，忽略email识别 -->
    <!-- 启用360浏览器的极速模式(webkit) -->
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
    <meta name="HandheldFriendly" content="true">
    <!-- 微软的老式浏览器 -->
    <meta name="MobileOptimized" content="320">
    <!-- uc强制竖屏 -->
    <meta name="screen-orientation" content="portrait">
    <!-- QQ强制竖屏 -->
    <meta name="x5-orientation" content="portrait">
    <!-- UC强制全屏 -->
    <meta name="full-screen" content="yes">
    <!-- QQ强制全屏 -->
    <meta name="x5-fullscreen" content="true">
    <!-- UC应用模式 -->
    <meta name="browsermode" content="application">
    <!-- QQ应用模式 -->
    <meta name="x5-page-mode" content="app">
    <!-- windows phone 点击无高光 -->
    <meta name="msapplication-tap-highlight" content="no">
    <title>意向单详情</title>
    <link rel="stylesheet" href="{{asset('css/reset.css')}}">
    <link rel="stylesheet" href="{{asset('css/main.css')}}">
    <link rel="stylesheet" href="{{asset('css/index.css')}}">
    <link rel="stylesheet" href="{{asset('css/LCalendar.css')}}">
    <link rel="stylesheet" href="{{asset('css/yd_rl.css')}}" />
</head>
<body>
    <!-- 公共头部 -->
    <div class="g2_head-bg">
        <!-- 返回上一层 -->
        <p class="g2_head_goback-bg fl">
            <a href="{{url('order')}}">
                <img src="{{asset('images/xky_icon0-1.png')}}" class="g2_head_goback_icon fl" alt="">
                <span class="g2_head_goback_del fl">返回</span>
            </a>
        </p>
        <p class="ym-tit fl">意向单详情</p>
        <span class="g2_head_goback_del fr khxz_color">新增</span>
        <span class="g2_head_goback_del fr gdlb_sx">筛选</span>
        <div class="cl"></div>
    </div>
    <div class="g2_head-bg2"></div>

    <!-- 工单（意向单）详情 -->
    <div class="gdyxd-bg">
        <form action="" id="yixiangform">
            {{ csrf_field() }}
            <input type="hidden" name="id" id="id" value="{{$order->id}}">
            <p class="gdx2_tit">工单信息</p>
            <ul class="grzx_xq-bg">
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">旅游类型</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                <input type="text" id='lvyouleixing' name="order_didian" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="{{$order->order_didian}}" placeholder="请选择旅游类型">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm">
                                @foreach($type as $vo)
                                    <li>{{$vo->title}}</li>
                                @endforeach
                            </ul>
                        </span>
        
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">旅游地点</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                <input type="text" class="lvyd2" id="didian" name="order_didian2" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="{{$order->order_didian2}}" placeholder="请选择旅游地点">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm" id="lvyoudidian">
                            </ul>
                        </span>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">旅游线路</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name='order_xianlu' placeholder="请输入旅游线路" class="grzx_xgsjhm" value="{{$order->order_xianlu}}">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">标签</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                 <input type="text" name="order_lvyouleibie" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="{{$order->order_lvyouleibie}}" placeholder="请选择标签">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm">
                                @foreach($biaoqian as $vo)
                                    <li>{{$vo->name}}</li>
                                @endforeach
                            </ul>
                        </span>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list" style="position:relative;">
                    <p class="grzx_xgname fl">出发时间</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="order_lvyoudate" id="start_date" class="start_date" value="{{$order->order_lvyoudate}}" readonly="readonly" />
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">工单备注</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="order_beizhu" class="grzx_xgsjhm" placeholder="请输入备注详情" value="{{$order->order_beizhu}}">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">工单状态</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                 <input type="text" name="order_statue" id="order_statue" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="{{$order->order_statue}}" placeholder="请选择状态">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm">
                                <li>商谈</li>
                                <li>成功</li>
                                <li id='bai'>失败</li>
                            </ul>
                        </span>
                    <div class="cl"></div>
                </li>
                @if($order->order_statue=='失败')
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">失败原因</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text"  class="grzx_xgsjhm"  value="{{$order->order_yuanyin}}">
                    </p>
                    <div class="cl"></div>
                </li>
                @endif
                <!-- 意向单失败原因 -->
                <div class="yxd_sb-bg">
                <p class="yxd_sbtit">失败原因</p >
                <textarea name="order_yuanyin" id="" class="yxd_sbdel"></textarea>
                <input type="button" class="yxd_sbqdbtn fl" value="确 定">
                <input type="button" class="yxd_sbqxbtn fr" value="取 消">
                </div>
            </ul>
            <!-- 客户信息（意向单）详情 -->
            <p class="gdx2_tit">客户信息</p>
            <ul class="grzx_xq-bg">
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户来源</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_laiyuan}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户姓名</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_name}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户年龄</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_age}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户性别</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_sex}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户电话</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_phone}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户微信</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_weixin}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户QQ</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_qq}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">电子邮箱</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_email}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">身份证号</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_sfz}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户类别</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_type}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">单位名称</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_danwei}}</p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">备注</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">{{$customer->customer_beizhu}}</p>
                    <div class="cl"></div>
                </li>
            </ul>
            <div style="width:100%;height:20vw;"></div>
            <!-- 按钮 -->
            <div class="gdyxd_gdjl-bg">
                <!-- <input type="button" class="gdyxd_gdjl-btn" value="跟单记录"> -->
                <a href="{{url('gendan')}}/{{$order->id}}" class="gdyxd_gdjl-btn">跟单记录</a>
            </div>
            <div class="gdyxd_gdcz-bg">
                <input type="button" id="tijiao" class="gdyxd_gdcz-btn" value="提交">
            </div>
        </form>
        
    </div>

    <!-- 遮罩 -->
    <!-- loading 小圆圈 -->
    <div class="z2_loading-bg" style="width:100%;height:100%;background:rgba(255,255,255,0.6);position:fixed;;left:0;top:0;">
        <img src="{{asset('images/loading1.gif')}}" style="width:10%;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;" alt="">
    </div>
    <!-- loadning对号 -->
    <div class="duihao" style="width:100%;height:100%;position:fixed;;left:0;top:0;display:none;">
        <img src="{{asset('images/duihao.png')}}" style="width:10%;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;" alt="">
    </div>
    <!-- 下拉框遮罩-->
    <div class="xlz2-bg" style="width:100%;height:100%;position:fixed;left:0;top:0;background:transparent;z-index:-1;"></div>
    <!-- 提示信息 -->
    <p id="tishi" style="display:none;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;width:94%;height:8vw;line-height:8vw;color:#fff;font-size:1.6rem;text-align:center;background:rgba(0,0,0,0.5);border-radius:4px;"></p>
    <script src="{{asset('js/jquery.min.js')}}"></script>
    <script src="{{asset('js/fastclick.min.js')}}"></script>
</body>
    <script src="{{asset('js/LCalendar.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/index.js')}}" type="text/javascript" charset="utf-8"></script>
    <script>
        // 意向单失败原因
        $('#bai').click(function(){
            // alert($("#order_statue").val());
            $("#order_statue").val('失败');
            $('.yxd_sb-bg').fadeIn(500);
            $('.yxd_sbqdbtn').click(function(){
               $('.yxd_sb-bg').fadeOut(500); 
            })
            $('.yxd_sbqxbtn').click(function(){
                $('.yxd_sb-bg').fadeOut(500);
            })
        })  
        $(function () {
            FastClick.attach(document.body);
        });
        $(function(){  
            $("#didian").click(function(){
                $("#didian").val('');
                var lvyouleixing=$("#lvyouleixing").val();
                $.ajax({
                    url:"{{url('lvyouleixing')}}",
                    type:'get', //GET
                    async:false,    //或false,是否异步
                    data:{'lvyouleixing':lvyouleixing},
                    dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                    success:function(data){ 
                        var html="";
                        $.each(data,function(i,item){
                            html+="<li>"+item+"</li>";
                    　　});
                        $("#lvyoudidian").html(html);
                        $("#lvyoudidian li").click(function(){
                            // alert($(this).html())
                            $("#didian").val($(this).html());
                            $("#lvyoudidian").css('display','none');
                        })
                    }, 
                })
            }); 
        })
        $(function () {
             $("#tijiao").click(function(){
                if($("input[name='order_didian']").val()==''){
                    $("#tishi").html('旅游类型必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_didian2']").val()==''){
                    $("#tishi").html('旅游地点必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_xianlu']").val()==''){
                    $("#tishi").html('旅游线路必须输入');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_lvyouleibie']").val()==''){
                    $("#tishi").html('标签必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_lvyoudate']").val()==''){
                    $("#tishi").html('出发时间必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_beizhu']").val() ==''){
                    $("#tishi").html('工单备注必须输入');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else{
                    var d = {};
                    var t = $('#yixiangform').serializeArray();
                    $.each(t, function() {
                      d[this.name] = this.value;
                    });
                    var data=JSON.stringify(d);
                    $.ajax({
                        url:"{{url('chengjiao/xiugai')}}",
                        type:'post', 
                        async:false,    //或false,是否异步
                        data:{'_token':'{{csrf_token()}}','data':data},
                        dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                        beforeSend:function(){
                            console.log('发送前');
                            $('.z2_loading-bg').show();
                        },
                        success:function(data){
                            if(data=="false"){
                                $('.z2_loading-bg').hide();
                                $("#tishi").html('录入失败');
                                $("#tishi").stop(true, true).fadeIn('fast');
                                $("#tishi").fadeOut(1500);
                            }else if(data.order_statue==4){
                                $(location).attr('href', "{{url('deal/tianjia')}}/"+data.id);
                            }else{
                                $('.z2_loading-bg').hide();
                                $('.duihao').show();
                                $('.duihao').hide(1000);
                                window.location.reload();
                            }
                        }, 
                    })
                }
            });
        });
        window.onload = function (event) {
            $(".z2_loading-bg").hide();
        }
    </script>
    <script type="text/javascript">
        var calendar = new LCalendar();
        calendar.init({
            'trigger': '#start_date', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': (new Date().getFullYear() - 3) + '-' + 1 + '-' + 1, //最小日期
            'maxDate': (new Date().getFullYear() + 3) + '-' + 12 + '-' + 31 //最大日期
        });

        var calendar = new LCalendar();
        calendar.init({
            'trigger': '#end_date', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': (new Date().getFullYear() - 3) + '-' + 1 + '-' + 1, //最小日期
            'maxDate': (new Date().getFullYear() + 3) + '-' + 12 + '-' + 31 //最大日期
        });
        $('.date_btn').click(function () {
            alert(111);
            $('.grzx_xgdate').css('display', 'block');
        })
        
    </script>
</html>